package com.example.administrator.jinagsu2021_2;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class Setting extends AppCompatActivity {
    private EditText et_maxtemp,et_maxhum;
    private Button btn_save;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        et_maxhum=findViewById(R.id.et_maxhum);
        et_maxtemp=findViewById(R.id.et_maxtemp);
        btn_save=findViewById(R.id.btn_save);
        btn_save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String maxhum = et_maxhum.getText().toString().trim();
                String maxtemp = et_maxtemp.getText().toString().trim();
                boolean b=SaveandGet.save(maxtemp,maxhum,Setting.this);//这里存最大值,这里点设置 就跳转导main
                Log.i("Setting", b + "");
                Intent intent=new Intent(Setting.this,MainActivity.class);//这里设置最大值，跳到main，我没点设置没跳进来
                startActivity(intent);
                Toast.makeText(Setting.this,"保存"+b,Toast.LENGTH_SHORT).show();
            }
        });



    }
}
